<script>
function checkColor(value,dom)
{
	var r=230;
	var g=230;
	var b=230;
	if(value>0)
	{
		r=r-value;
		b=b-value;
		var opa=0.5+(value/150.0)/2.0;	
		dom.parent().parent().children("#home-item-image-angry").css({ opacity: 1-opa });
		dom.parent().parent().children("#home-item-image-happy").css({ opacity: opa });
		dom.css('background', 'rgb('+r+','+g+','+b+')');
		
	}
	else
	{
		g=g+value;
		b=b+value;
		var opa=0.5-(value/150.0)/2.0;
		dom.parent().parent().children("#home-item-image-angry").css({ opacity: opa });
		dom.parent().parent().children("#home-item-image-happy").css({ opacity: 1-opa });
		dom.css('background', 'rgb('+r+','+g+','+b+')');
	}
}



$(document).ready(function()
{
	$(".slider").each(function()
	{
	
		$(this).slider(
		{
			min:-150,
			max:150,
			slide: function( event, ui ) 
			{
						
				checkColor(ui.value,$(this))
			}
		});
		
		$(this).css('background', 'rgb(230,230,230)');
		$(this).parent().parent().children("#home-item-image-happy").css({ opacity: 0.5 });
		$(this).parent().parent().children("#home-item-image-angry").css({ opacity: 0.5 });
		
	});	

	<?php 
		$QE=$this->session->userdata("questionev");
		
		if($QE)
		{
			
			foreach ($QE as $item)
			{
					
			 	echo '
					$("#QERID'.$item[0].'").slider("option","value","'.$item[1].'");
					checkColor('.$item[1].',$("#QERID'.$item[0].'"));
					';
			}
		}
	?>
});
</script>

<?php
/*print_r($this->session->userdata('questionev'));

print_r($this->session->userdata('employeeev'));*/
?>

<?php 

echo
'
	<div style="text-align:center">'
		//.'<h1>Bienvenido a '.$company['name'].'</h1>'
		.'<h2>Est&aacutes evaluando desde '.$qr_code['place'].'</h2>'
		.'<p style="font-size:11px">Puedes evaluar nuestros servicios y empleados de forma directa y privada con la administraci&oacuten</p>'
		.'<div class="h-line"></div>
	</div>	
';



foreach($question as $item)
{
	echo
	'
		<div class="home-item" name="'.$item['question'].'">
			<div class="home-item-head">'.$item['question'].'</div>
			<div class="home-item-image" id="home-item-image-angry"></div>
			<div class="home-item-slider"><div id="QERID'.$item['id'].'" class="slider" QERID="'.$item['id'].'"></div></div>
			<div class="home-item-image" id="home-item-image-happy"></div>	
		</div>		
	';
	
}


?>